<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
 test(() => {
   // Headers.idl has an iterable<k, v> declaration.
   let iterator = new Headers().entries();
   let iteratorProto = Object.getPrototypeOf(iterator);
   let iteratorProtoProto = Object.getPrototypeOf(iteratorProto);

   assert_array_equals(Object.getOwnPropertyNames(iterator), [],
                       "The default iterator object has no properties of its own.");
   assert_array_equals(Object.getOwnPropertySymbols(iterator), [],
                       "The default iterator object has no symbols of its own.");

   assert_in_array("next", Object.getOwnPropertyNames(iteratorProto),
                   "The iterator prototype object has a property called 'next'.");
   let nextProperty = Object.getOwnPropertyDescriptor(iteratorProto, "next");
   assert_true(nextProperty.configurable, "The 'next' property must be configurable.");
   assert_true(nextProperty.enumerable, "The 'next' property must be enumerable.");
   assert_true(nextProperty.writable, "The 'next' property must be writable.");

   assert_equals(iteratorProtoProto,
                 Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),
                 "The iterator prototype object's [[Prototype]] is %IteratorPrototype.");
   assert_array_equals(Object.getOwnPropertyNames(iteratorProtoProto), [],
                       "%IteratorPrototype% has no properties of its own");
   assert_array_equals(Object.getOwnPropertySymbols(iteratorProtoProto),
                       [Symbol.iterator],
                       "%IteratorPrototype% has defines @@iterator.");
   assert_equals(Object.getPrototypeOf(iteratorProtoProto), Object.prototype,
                 "%IteratorPrototype% descends from %ObjectPrototype%.");
 }, "Iterators from pair-iterable interfaces inherit from %IteratorPrototype%");
</script>
